import Vue from 'vue'
import App from './App.vue'
import axios from 'axios'
import VueAxios from 'vue-axios'
Vue.use(VueAxios, axios);



import './assets/common.less'

import dataV from '@jiaminghi/data-view'

Vue.config.productionTip = false

Vue.use(dataV)


// 这里是添加的部分
function getCsrftokenByCookie() {
    const cookie = document.cookie.split(';')
        // 获取csrftoken
    let csrftoken = ''
    for (const i in cookie) {
        if (cookie[i].indexOf('csrftoken') !== -1) {
            csrftoken = cookie[i].split('=')[1]
        }
    }
    return csrftoken
}
// 每次请求头都带上我们的X-CSRFToken 信息
axios.defaults.headers.common['X-CSRFToken'] = getCsrftokenByCookie()
axios.defaults.withCredentials = true
Vue.config.productionTip = false
axios.defaults.baseURL = window.location.href + 'dash/';
// axios.defaults.baseURL = 'http://appdev.paas.skyatlas.net:8000/dash/';

new Vue({
    render: h => h(App)
}).$mount('#app')